﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Phase_lookup_list.aspx.cs" Inherits="m_gestione_Phase_Phase_lookup_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Phase</title>
    <link href="/timereport/include/commoncss.aspx" rel="stylesheet" type="text/css" />
</head>
    <script language="JavaScript" src="/timereport/include/menu/menu_array.js" type="text/javascript"></script>
    <script language="JavaScript" src="/timereport/include/menu/mmenu.js" type="text/javascript"></script>
<body>

<table width="760" border="0">
        <tr>
            <td height="30" class="BarraTop" align="right">Utente: <%= Session["UserName"] %>
            </td>
        </tr>
          <tr>
            <td height="30">&nbsp;</td>
           </tr>

    <tr><td>

    <form id="form1" runat="server">
       <table border="0" class="GridTab">
              <tr><td>
                Progetto:
            </td>
            <td>
                <asp:DropDownList ID="DL_progetto" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
                    DataSourceID="DSprogetti" DataTextField="iProgetto" DataValueField="Projects_Id"
                    OnSelectedIndexChanged="DL_progetto_SelectedIndexChanged1" OnDataBound="DL_progetto_DataBound"
                    Width="150px" CssClass="TabellaLista">
                    <asp:ListItem Text="Tutti i valori" Value="all" />
                </asp:DropDownList>
            </td>
        </tr>
    </table>
 
    <div>

        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  CssClass="GridView"
            AutoGenerateColumns="False" DataKeyNames="Phase_id" 
            DataSourceID="DSPhase" EnableModelValidation="True" 
            onrowdeleting="GridView1_RowDeleting" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">
            <FooterStyle CssClass="GV_footer" />
            <RowStyle Wrap="False" CssClass="GV_row" />
            <PagerStyle CssClass="GV_footer" />
            <HeaderStyle CssClass="GV_header" />
        <AlternatingRowStyle CssClass="GV_row_alt " />
            <Columns>
                <asp:BoundField DataField="NomeProgetto" HeaderText="Progetto" 
                    SortExpression="ProjectCode" ReadOnly="True" />
                <asp:BoundField DataField="NomeFase" HeaderText="Fase" 
                    SortExpression="PhaseCode" />
                <asp:BoundField DataField="Phase_id" HeaderText="Phaseid" Visible="False" 
                SortExpression="Phase_id" />
                <asp:CommandField ShowDeleteButton="True" ShowSelectButton="True" ButtonType="Image" HeaderText="Azioni"
                DeleteImageUrl="/timereport/images/icons/16x16/trash.gif" SelectImageUrl="/timereport/images/icons/16x16/modifica.gif" />
            </Columns>
        </asp:GridView>
            <br />
         <asp:Button ID="btn_crea" runat="server" Text="Crea" CssClass="Gridbutton"
               PostBackUrl="/timereport/m_gestione/Phase/Phase_lookup_form.aspx" />
          <asp:Button ID="btn_back" runat="server" Text="Annulla" CssClass="Gridbutton" PostBackUrl="/timereport/menu.aspx" />

    </div>
        
    </form>

    </td></tr>   

    </table>

    <asp:SqlDataSource ID="DSPhase" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
        DeleteCommand="DELETE FROM Phase WHERE (Phase_id = @Phase_id)" 
        
        SelectCommand="SELECT Phase_id, Phase.PhaseCode, Phase.Name, Phase.Projects_id, Projects.ProjectCode + N'  ' + Projects.Name AS ProjectCode FROM Phase INNER JOIN Projects ON Phase.Projects_id = Projects.Projects_Id WHERE (Projects.ClientManager_id = @sel_managerid) AND (Projects.Projects_Id = @DL_progetto)" >
        
        <SelectParameters>
            <asp:SessionParameter Name="sel_managerid" SessionField="persons_id" />
            <asp:ControlParameter ControlID="DL_progetto" Name="DL_progetto" PropertyName="SelectedValue" />
        </SelectParameters>    

        <DeleteParameters>
            <asp:Parameter Name="Phase_id" Type="Int32" />
        </DeleteParameters>
    </asp:SqlDataSource>
    
    <asp:SqlDataSource ID="DSprogetti" runat="server" ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>"
        SelectCommand="SELECT Projects_Id, ProjectCode + N'  ' + Name AS iProgetto, ClientManager_id, Active FROM Projects WHERE (ClientManager_id = @managerid) AND (Active = 1) and (ActivityOn = 1) ORDER BY iProgetto">
        <SelectParameters>
            <asp:SessionParameter Name="managerid" SessionField="persons_id" />
        </SelectParameters>
    </asp:SqlDataSource>

</body>
</html>
